package com.csc.fsu.financials.dataaccess;

import com.quipoz.framework.datatype.*;
import com.quipoz.framework.util.QPUtilities;
import com.csc.common.DD;
import com.csc.smart400framework.dataaccess.PFAdapterDAM;


/**
 * 	
 * File: CheqpfTableDAM.java
 * Date: Sat, 5 Nov 2011 07:03:39
 * Class transformed from CHEQPF
 * Author: Quipoz Limited
 *
 * Copyright (2007) CSC Asia, all rights reserved
 *
 */
public class CheqpfTableDAM extends PFAdapterDAM {

	public int pfRecLen = 399;
	public FixedLengthStringData cheqrec = new FixedLengthStringData(pfRecLen);
	public FixedLengthStringData cheqpfRecord = cheqrec;
	
	public FixedLengthStringData reqncoy = DD.reqncoy.copy().isAPartOf(cheqrec);
	public FixedLengthStringData reqnno = DD.reqnno.copy().isAPartOf(cheqrec);
	public FixedLengthStringData reqntype = DD.reqntype.copy().isAPartOf(cheqrec);
	public PackedDecimalData payamt = DD.payamt.copy().isAPartOf(cheqrec);
	public FixedLengthStringData reqnbcde = DD.reqnbcde.copy().isAPartOf(cheqrec);
	public FixedLengthStringData clntcoy = DD.clntcoy.copy().isAPartOf(cheqrec);
	public FixedLengthStringData clntnum01 = DD.clntnum.copy().isAPartOf(cheqrec);
	public FixedLengthStringData clntnum02 = DD.clntnum.copy().isAPartOf(cheqrec);
	public FixedLengthStringData clttype01 = DD.clttype.copy().isAPartOf(cheqrec);
	public FixedLengthStringData clttype02 = DD.clttype.copy().isAPartOf(cheqrec);
	public FixedLengthStringData surnam01 = DD.surnam.copy().isAPartOf(cheqrec);
	public FixedLengthStringData surnam02 = DD.surnam.copy().isAPartOf(cheqrec);
	public FixedLengthStringData salNInit01 = DD.salninit.copy().isAPartOf(cheqrec);
	public FixedLengthStringData salNInit02 = DD.salninit.copy().isAPartOf(cheqrec);
	public FixedLengthStringData capname = DD.capname.copy().isAPartOf(cheqrec);
	public FixedLengthStringData cheqno = DD.cheqno.copy().isAPartOf(cheqrec);
	public FixedLengthStringData cheqdupn = DD.cheqdupn.copy().isAPartOf(cheqrec);
	public FixedLengthStringData bankkey = DD.bankkey.copy().isAPartOf(cheqrec);
	public FixedLengthStringData bankacckey = DD.bankacckey.copy().isAPartOf(cheqrec);
	public FixedLengthStringData facthous = DD.facthous.copy().isAPartOf(cheqrec);
	public PackedDecimalData requser = DD.requser.copy().isAPartOf(cheqrec);
	public PackedDecimalData reqdate = DD.reqdate.copy().isAPartOf(cheqrec);
	public PackedDecimalData reqtime = DD.reqtime.copy().isAPartOf(cheqrec);
	public FixedLengthStringData procind = DD.procind.copy().isAPartOf(cheqrec);
	public PackedDecimalData authuser = DD.authuser.copy().isAPartOf(cheqrec);
	public PackedDecimalData authdate = DD.authdate.copy().isAPartOf(cheqrec);
	public PackedDecimalData authtime = DD.authtime.copy().isAPartOf(cheqrec);
	public PackedDecimalData appruser = DD.appruser.copy().isAPartOf(cheqrec);
	public PackedDecimalData apprdte = DD.apprdte.copy().isAPartOf(cheqrec);
	public PackedDecimalData apprtime = DD.apprtime.copy().isAPartOf(cheqrec);
	public PackedDecimalData paydate = DD.paydate.copy().isAPartOf(cheqrec);
	public PackedDecimalData archdate = DD.archdate.copy().isAPartOf(cheqrec);
	public FixedLengthStringData presflag = DD.presflag.copy().isAPartOf(cheqrec);
	public PackedDecimalData presdate = DD.presdate.copy().isAPartOf(cheqrec);
	public PackedDecimalData stmtpage = DD.stmtpage.copy().isAPartOf(cheqrec);
	public FixedLengthStringData paycurr = DD.paycurr.copy().isAPartOf(cheqrec);
	public PackedDecimalData transactionDate = DD.trdt.copy().isAPartOf(cheqrec);
	public PackedDecimalData transactionTime = DD.trtm.copy().isAPartOf(cheqrec);
	public PackedDecimalData user = DD.user.copy().isAPartOf(cheqrec);
	public FixedLengthStringData termid = DD.termid.copy().isAPartOf(cheqrec);
	public FixedLengthStringData branch = DD.branch.copy().isAPartOf(cheqrec);
	public FixedLengthStringData reqnrev = DD.reqnrev.copy().isAPartOf(cheqrec);
	public FixedLengthStringData reversalInd = DD.revind.copy().isAPartOf(cheqrec);
	public PackedDecimalData zprnno = DD.zprnno.copy().isAPartOf(cheqrec);
	public FixedLengthStringData userProfile = DD.usrprf.copy().isAPartOf(cheqrec);
	public FixedLengthStringData jobName = DD.jobnm.copy().isAPartOf(cheqrec);
	public FixedLengthStringData datime = DD.datime.copy().isAPartOf(cheqrec);
	public FixedLengthStringData vchno = DDimp.vchno.copy().isAPartOf(cheqrec);

	/**
	* Default Constructor for TableDAMs. Locks are not taken on data.
	*/	
	public CheqpfTableDAM() {
  		super();
  		setColumns();
  		journalled = true;
	}

	/**
	* Constructor for CheqpfTableDAM that accepts boolean update flag indicating
	* whether or not to lock the table.
	*/	
	public CheqpfTableDAM(boolean updateMode) {
  		super(updateMode);
  		setColumns();
	}

	/**
	* Constructor for CheqpfTableDAM that accepts boolean update indicator,
	* and a data structure for file feedback information (equivalent of INFDS on RPG)
	*/	
	public CheqpfTableDAM(boolean updateMode, FixedLengthStringData feedbackArea) {
  		super(updateMode, feedbackArea);
  		setColumns();
	}

	/**
	* Constructor for CheqpfTableDAM that accepts a data structure for
	* file feedback information (equivalent of INFDS on RPG)
	*/	
	public CheqpfTableDAM(FixedLengthStringData feedbackArea) {
  		super(feedbackArea);
  		setColumns();
	}

	public void setTable() {
		TABLEPF = getTableName("CHEQPF");
	}

	public String getPFTable() {
		return TABLEPF;
	}

	public void setColumnConstants() {
	
		QUALIFIEDCOLUMNS = 
							"REQNCOY, " +
							"REQNNO, " +
							"REQNTYPE, " +
							"PAYAMT, " +
							"REQNBCDE, " +
							"CLNTCOY, " +
							"CLNTNUM01, " +
							"CLNTNUM02, " +
							"CLTTYPE01, " +
							"CLTTYPE02, " +
							"SURNAM01, " +
							"SURNAM02, " +
							"SALNINIT01, " +
							"SALNINIT02, " +
							"CAPNAME, " +
							"CHEQNO, " +
							"CHEQDUPN, " +
							"BANKKEY, " +
							"BANKACCKEY, " +
							"FACTHOUS, " +
							"REQUSER, " +
							"REQDATE, " +
							"REQTIME, " +
							"PROCIND, " +
							"AUTHUSER, " +
							"AUTHDATE, " +
							"AUTHTIME, " +
							"APPRUSER, " +
							"APPRDTE, " +
							"APPRTIME, " +
							"PAYDATE, " +
							"ARCHDATE, " +
							"PRESFLAG, " +
							"PRESDATE, " +
							"STMTPAGE, " +
							"PAYCURR, " +
							"TRDT, " +
							"TRTM, " +
							"USER_T, " +
							"TERMID, " +
							"BRANCH, " +
							"REQNREV, " +
							"REVIND, " +
							"ZPRNNO, " +
							"USRPRF, " +
							"JOBNM, " +
							"DATIME, " +
							"VCHNO, " +
							"UNIQUE_NUMBER";
	}

	public void setColumns() {
	
		qualifiedColumns = new BaseData[] {
                                     reqncoy,
                                     reqnno,
                                     reqntype,
                                     payamt,
                                     reqnbcde,
                                     clntcoy,
                                     clntnum01,
                                     clntnum02,
                                     clttype01,
                                     clttype02,
                                     surnam01,
                                     surnam02,
                                     salNInit01,
                                     salNInit02,
                                     capname,
                                     cheqno,
                                     cheqdupn,
                                     bankkey,
                                     bankacckey,
                                     facthous,
                                     requser,
                                     reqdate,
                                     reqtime,
                                     procind,
                                     authuser,
                                     authdate,
                                     authtime,
                                     appruser,
                                     apprdte,
                                     apprtime,
                                     paydate,
                                     archdate,
                                     presflag,
                                     presdate,
                                     stmtpage,
                                     paycurr,
                                     transactionDate,
                                     transactionTime,
                                     user,
                                     termid,
                                     branch,
                                     reqnrev,
                                     reversalInd,
                                     zprnno,
                                     userProfile,
                                     jobName,
                                     datime,
                                     vchno,
                                     unique_number
		                 };
	}

	/**
	* Method to clear all fields in the Physical File record
	* @return
	*/	
	public void initialize() {
  		reqncoy.clear();
  		reqnno.clear();
  		reqntype.clear();
  		payamt.clear();
  		reqnbcde.clear();
  		clntcoy.clear();
  		clntnum01.clear();
  		clntnum02.clear();
  		clttype01.clear();
  		clttype02.clear();
  		surnam01.clear();
  		surnam02.clear();
  		salNInit01.clear();
  		salNInit02.clear();
  		capname.clear();
  		cheqno.clear();
  		cheqdupn.clear();
  		bankkey.clear();
  		bankacckey.clear();
  		facthous.clear();
  		requser.clear();
  		reqdate.clear();
  		reqtime.clear();
  		procind.clear();
  		authuser.clear();
  		authdate.clear();
  		authtime.clear();
  		appruser.clear();
  		apprdte.clear();
  		apprtime.clear();
  		paydate.clear();
  		archdate.clear();
  		presflag.clear();
  		presdate.clear();
  		stmtpage.clear();
  		paycurr.clear();
  		transactionDate.clear();
  		transactionTime.clear();
  		user.clear();
  		termid.clear();
  		branch.clear();
  		reqnrev.clear();
  		reversalInd.clear();
  		zprnno.clear();
  		userProfile.clear();
  		jobName.clear();
  		datime.clear();
  		vchno.clear();
	}

	/**
	* Getter corresponding to record's DD-ALL-FORMATS record
	* @return
	*/	
	public FixedLengthStringData getCheqrec() {
  		return cheqrec;
	}

	public FixedLengthStringData getCheqpfRecord() {
  		return cheqpfRecord;
	}

	/**
	* Setter corresponding to record's DD-ALL-FORMATS record
	*/	
	public void set(Object what) {
  		setCheqrec(what);
	}

	public void setCheqrec(Object what) {
  		this.cheqrec.set(what);
	}

	public void setCheqpfRecord(Object what) {
  		this.cheqpfRecord.set(what);
	}

	public FixedLengthStringData getBaseString() {
		FixedLengthStringData result = new FixedLengthStringData(cheqrec.getLength());
		result.set(cheqrec);
  		return result;
	}
	
	public String toString() {
  		return getBaseString().toString();
	}
	
	// The following methods are not required by the PF tableDAM, but are fully implemented 
	// in the LF tableDAM
	@Override
	public FixedLengthStringData setHeader(Object what) {
		return null;
	}

	@Override
	public FixedLengthStringData getHeader() {
		return null;
	}

	@Override
	protected void clearRecKeyData() {
	}

	@Override
	protected void clearRecNonKeyData() {
	}
	
	public FixedLengthStringData getVchno(){
		return vchno;
	}
	public void setVchno(Object what) {
		vchno.set(what);
	}

}